home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / appsrcs.zip / APPSETUP.ZIP / APPEND.C < prev    next >
C/C++ Source or Header  |  1993-05-05  |  3KB  |  97 lines

  1. #define STRICT
  2. #include <windows.h>
  3. #include <windowsx.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <direct.h>
  7. #include <string.h>
  8. #include "appsetup.h"
  9.  
  10. /*-------------------------------------------------------------------------*/
  11. BOOL WINAPI InitEndDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  12.     {
  13.     static int    iFirstChoise, iSecondChoise;
  14.     char    InitString[MAXDIGITS], LoadString[4*MAXFILECHARS];
  15.     char    *AutoStartString;
  16.  
  17.     switch(message)
  18.     {
  19.     case WM_INITDIALOG:
  20.         iFirstChoise = 2;
  21.         iSecondChoise = 2;
  22.         CheckRadioButton(hDlg, IDEND_SHELL, IDEND_NONE, IDEND_NONE);
  23.         CheckRadioButton(hDlg, IDEND_START, IDEND_EXIT, IDEND_EXIT);
  24.         CheckDlgButton(hDlg, IDEND_SAVE, 1);
  25.         return TRUE;
  26.  
  27.     case WM_COMMAND:
  28.         switch(wParam)
  29.         {
  30.         case IDEND_SHELL:
  31.             iFirstChoise = 0;
  32.             CheckRadioButton(hDlg, IDEND_SHELL, IDEND_NONE, IDEND_SHELL);
  33.             return TRUE;
  34.  
  35.         case IDEND_LOAD:
  36.             iFirstChoise = 1;
  37.             CheckRadioButton(hDlg, IDEND_SHELL, IDEND_NONE, IDEND_LOAD);
  38.             return TRUE;
  39.  
  40.         case IDEND_NONE:
  41.             iFirstChoise = 2;
  42.             CheckRadioButton(hDlg, IDEND_SHELL, IDEND_NONE, IDEND_NONE);
  43.             return TRUE;
  44.  
  45.            case IDEND_START:
  46.             iSecondChoise = 0;
  47.             CheckRadioButton(hDlg, IDEND_START, IDEND_EXIT, IDEND_START);
  48.             return TRUE;
  49.  
  50.            case IDEND_RESTART:
  51.             iSecondChoise = 1;
  52.             CheckRadioButton(hDlg, IDEND_START, IDEND_EXIT, IDEND_RESTART);
  53.             return TRUE;
  54.  
  55.            case IDEND_EXIT:
  56.             iSecondChoise = 2;
  57.             CheckRadioButton(hDlg, IDEND_START, IDEND_EXIT, IDEND_EXIT);
  58.             return TRUE;
  59.  
  60.            case IDEND_SAVE:
  61.             CheckDlgButton(hDlg, IDEND_SAVE, !IsDlgButtonChecked(hDlg, IDEND_SAVE));
  62.             return TRUE;
  63.  
  64.         case IDEND_OK:
  65.             sprintf(szBuffer,"%d",APPBARVERSION);
  66.             WritePrivateProfileString(INI_SYSTEM, INITIALIZED, szBuffer, INI_FILE);
  67.             if(IsDlgButtonChecked(hDlg, IDEND_SAVE))
  68.             IniSave();
  69.             if(iFirstChoise == 1)
  70.             {
  71.             GetProfileString("windows", "load", "  ", LoadString, (3*MAXFILECHARS)-1);
  72.             AutoStartString = strcat(strcat(LoadString, " "), "appbar.exe");
  73.             WriteProfileString("windows", "load", AutoStartString);
  74.             }
  75.             if(iFirstChoise == 0)
  76.             WritePrivateProfileString("boot", "shell","appbar.exe", "system.ini");
  77.             if(iSecondChoise == 0)
  78.             WinExec("appbar.exe", SW_SHOWNORMAL);
  79.             if(iSecondChoise == 1)
  80.             ExitWindows(EW_RESTARTWINDOWS, 0);
  81.             EndDialog(hDlg, 0);
  82.             PostMessage(hWnd, WM_CLOSE, 0, 0);
  83.             return TRUE;
  84.  
  85.         case IDEND_CANCEL:
  86.             sprintf(InitString,"%d",APPBARVERSION);
  87.             WritePrivateProfileString(INI_SYSTEM, INITIALIZED, InitString, INI_FILE);
  88.             EndDialog(hDlg, 0);
  89.             InvalidateRect(hWnd, NULL, TRUE);
  90.             UpdateWindow(hWnd);
  91.             return TRUE;
  92.         }
  93.         break;
  94.     }
  95.     return FALSE;
  96.     }
  97.